package com.qiye.pointsserver.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiye.pointsserver.model.dto.AutherDto;
import com.qiye.pointsserver.model.entity.Auther;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【sys_auther(其他资源积分表)】的数据库操作Mapper
* @createDate 2025-07-08 19:44:16
* @Entity com.qiye.pointsserver.model.entity.Auther
*/
public interface AutherMapper extends BaseMapper<Auther> {


    @Select("""
    SELECT 
     *
    FROM 
      sys_auther as a
    WHERE
      (#{keyword} IS NULL OR #{keyword} = '' 
       OR a.type LIKE CONCAT('%', #{keyword}, '%') )
    ORDER BY a.create_time DESC
""")
    IPage<Auther> searchPage(Page<?> page, @Param("keyword") String keyword);


    @Select("""
    SELECT 
     a.id,a.type,a.points,a.time
    FROM 
      sys_auther as a
    ORDER BY a.create_time DESC
""")
    List<AutherDto> search();

}




